<%@ page import="com.rihel.model.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="static/css/bootstrap.min.css">
    <link rel="stylesheet" href="static/css/font-awesome.min.css">
    <script src="static/js/jquery.min.js"></script>
    <script src="static/js/bootstrap.min.js"></script>
    <title>666商城</title>
</head>
<body>
    <%
        HttpSession session1 = request.getSession();
        boolean isLogin = session1.getAttribute("user") != null;
        User user = null;
        if(isLogin){
            user = (User) session1.getAttribute("user");
        }
    %>
    <div class="navbar navbar-dark bg-primary navbar-expand-lg ">
        <div class="container">
            <a class="navbar-brand" href="/">
                666商城
            </a>



            <ul class="navbar-nav">
               <%if(isLogin){%>
                    <li class="nav-item"><a href="/usercenter.jsp" class="nav-link"><%=user.getUname()%></a></li>
                <%}else{%>
                    <li class="nav-item"> <a class="nav-link" href="/login.jsp">登录</a></li>
                    <li class="nav-item"><a class="nav-link" href="/register.jsp">注册</a></li>
                <%}%>
            </ul>

        </div>
    </div>
